package cn.edu.neusoft.model.bean;

import cn.edu.neusoft.model.event.eventSubcribe.ReceiveCarIOMsg;
import cn.edu.neusoft.model.event.eventSubcribe.ReceiveCarOverSpeedMsg;
import lombok.Data;

import java.lang.reflect.Field;
import java.util.Date;

@Data
public class OverSpeed {
    private String carNum;
    private int ownerId;
    private String capTime;
    private String parkingLotCode;
    private String devChnId;
    private String deviceCode;
    private String deviceName;
    private int blackFlag;
    private String alarmSpeed;
    private int alarmSpeedCount;
    private int alarmSpeedShowCount;
    private int configCount;
    private String carDirect;
    private int unitType;
    private String alarmPicture;

    public OverSpeed(ReceiveCarOverSpeedMsg a) throws IllegalAccessException {
        Field[] fieldsA = a.getClass().getDeclaredFields();
        Field[] fieldsB = this.getClass().getDeclaredFields();

        for (Field fieldA : fieldsA) {
            fieldA.setAccessible(true);
            for (Field fieldB : fieldsB) {
                fieldB.setAccessible(true);
                if (fieldA.getName().equals(fieldB.getName()) && fieldA.getType().equals(fieldB.getType())) {
                    fieldB.set(this, fieldA.get(a));
                }
            }
        }
    }
}
